package com.triones.yjj.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.mapper.BaseMapperPlus;
import com.triones.yjj.entity.MemberDistributionRecordDO;
import com.triones.yjj.entity.bo.DistributionParams;
import com.triones.yjj.entity.bo.MemberDistributionParams;
import com.triones.yjj.entity.vo.*;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 客户分销记录 mapper 接口
 *
 * @Author: triones
 */
public interface MemberDistributionRecordMapper extends BaseMapperPlus<MemberDistributionRecordMapper, MemberDistributionRecordDO, MemberDistributionRecordVO> {

    /**
     * 统计用户分销数据
     * @param memberId
     * @param userId
     * @return
     */
    List<Map> getDistributionNumber(@Param("memberId") Long memberId,@Param("userId") Long userId);

    /**
     * 获取客户分销列表（分页）
     * @param build
     * @param wrapper
     * @return
     */
    Page<MemberDistributionListVO> distributionPageList(@Param("page") Page<Object> build,@Param(Constants.WRAPPER) QueryWrapper<MemberDistributionRecordDO> wrapper);


    /**
     * 获取佣金和
     * @param activityId
     * @param memberId
     * @param userId
     * @return
     */
    String getKickbackTotal(@Param("activityId") Long activityId,@Param("memberId") Long memberId,@Param("userId") Long userId);

    Page<WxMemberDistributionRecordVO> getMemberDistributionPageList(@Param("page") Page<Object> build, @Param(Constants.WRAPPER) QueryWrapper<MemberDistributionRecordDO> wrapper);

    Page<WxMemberDistributionRecordVO> getMemberOneDistributionPageList(@Param("page") Page<Object> build, @Param(Constants.WRAPPER) QueryWrapper<MemberDistributionRecordDO> wrapper);

    Page<WxMemberDistributionRecordVO> getMemberTwoDistributionPageList(@Param("page") Page<Object> build, @Param(Constants.WRAPPER) QueryWrapper<MemberDistributionRecordDO> wrapper);

    Map<String,Object> getMemberDistributionCount(@Param("memberId") Long memberId,@Param("activityId") Long  activityId, @Param("distributionGrade") Integer distributionGrade);

    Page<DistributionVO> distributionRecordPageList(@Param("page") Page<DistributionVO> build,@Param("params") DistributionParams params);

    Page<DistributionOrderVO> distributionOrderPageList(@Param("page") Page<DistributionOrderVO> build,@Param("params") MemberDistributionParams params);
}
